bool hasCycle(struct ListNode* head) {
    struct ListNode* low = head;
    struct ListNode* fast = head;
   
    while (fast != NULL && fast->next != NULL)
    {
        fast = fast->next->next;
        low = low->next;
        if (low == fast)
        {
            return true;
        }
    }
    return false;
}